<template>
	<view>
		<web-view webview-styles="webviewStyles" :src="src"></web-view>
	</view>
</template>

<script>
	const $token = require('../../utils/token.js');
	const $user = require('../../utils/user.js');
	export default {
		data() {
			return {
				src: ''
			}
		},
		computed: {
			userInfo() {
				return this.$store.state.commen.userInfo;
			},
			userToken() {
				return this.$store.state.commen.userToken;
			},
		},
		onLoad(option) {
			// if (option.src) {
			// 	const src = `${option.src}?token=${this.userToken}&mobile=${this.userInfo.mobile}`
			// 	this.src = src
			// }
			// if (option.title) {
			// 	uni.setNavigationBarTitle({
			// 		title: option.title
			// 	})
			// }
			console.log('optionoption', option);
			let url = option.url //默认是打开微信公众号网页  linkType=weixin
			if (option.pageType && option.pageType == 'baoFuBindbank') {
				// 绑定 宝付银行卡
				const src = url + `?t=${Date.now()}&token=` + $token.get() + `&mobile=` + $user.get() +
					`&real_name_flag=${option.real_name_flag}&linkType=h5`
				url = src
				if (option.linkType) {
					uni.setStorageSync('linkType', option.linkType)
				}
			}
			this.src = decodeURIComponent(url)
		},
		onReady() {
			// #ifdef APP-PLUS
			var wv;
			var currentWebview = this.$mp.page.$getAppWebview();
			setTimeout(function() {
				wv = currentWebview.children()[0]
				wv.setStyle({
					scalable: true
				})
			}, 1000); //如果是页面初始化调用时，需要延时一下
			// #endif
		},
		methods: {

		}
	}
</script>

<style>

</style>